package o;

import android.text.TextUtils;
import com.huawei.appgallery.foundation.application.pkgmanage.model.update.ApkUpgradeInfo;
import java.util.Iterator;
import java.util.List;

public abstract class cfs implements dtk {
    private cfu ˏ = euc.ˊ().ʽ(ˋ());

    protected cfs() {
    }

    public List<? extends ApkUpgradeInfo> ˎ() {
        List<? extends ApkUpgradeInfo> ˋ = this.ˏ.ˋ(ˊ(), null);
        if (!ˋ.isEmpty()) {
            Iterator it = ˋ.iterator();
            while (it.hasNext()) {
                ApkUpgradeInfo apkUpgradeInfo = (ApkUpgradeInfo) it.next();
                if (!TextUtils.isEmpty(apkUpgradeInfo.ᐝ())) {
                    try {
                        if (((cdg) cdb.ॱ(cdg.class)).ʽ(apkUpgradeInfo.ᐝ())) {
                            it.remove();
                            Logger.ˎ("BaseUpgradeCache", "app has been stoped." + apkUpgradeInfo.ᐝ());
                        }
                    } catch (Throwable e) {
                        Logger.ˋ("BaseUpgradeCache", "please register IAppStatusManage", e);
                    }
                    ((ceq) cdb.ॱ(ceq.class)).ˊ(apkUpgradeInfo);
                }
            }
        }
        Logger.ˎ("BaseUpgradeCache", ˊ().getSimpleName() + "--getInfos FromCache size:" + ˋ.size());
        return ˋ;
    }

    public void ˋ(String str) {
        this.ˏ.ˋ("package_=?", new String[]{str});
    }

    public void ˏ(ApkUpgradeInfo apkUpgradeInfo) {
        if (this.ˏ.ˋ(ApkUpgradeInfo.class, "package_=?", new String[]{apkUpgradeInfo.ᐝ()}, null, null).isEmpty()) {
            ˎ(apkUpgradeInfo);
        } else {
            ˋ(apkUpgradeInfo);
        }
    }

    private void ˋ(ApkUpgradeInfo apkUpgradeInfo) {
        this.ˏ.ॱ(apkUpgradeInfo, "package_=?", new String[]{apkUpgradeInfo.ᐝ()});
    }

    private void ˎ(ApkUpgradeInfo apkUpgradeInfo) {
        this.ˏ.ˎ((cfr) apkUpgradeInfo);
    }

    public void ˊ(List list) {
        this.ˏ.ˎ(list);
    }

    public void ˏ() {
        this.ˏ.ˋ(null, null);
    }
}
